package com.demo.bookstore.service.impl;

import com.demo.bookstore.bean.User;
import com.demo.bookstore.dao.UserDao;
import com.demo.bookstore.dao.impl.UserDaoImpl;
import com.demo.bookstore.service.UserService;
import com.demo.bookstore.util.Md5Util;

import java.util.List;

/**
 * @author ddone
 * @date 2024/3/12-11:05
 */
public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();

    @Override
    public User findUserByUp(User user) {
        user.setPwd(Md5Util.encode(user.getPwd()));
        return userDao.findUserByUp(user);
    }

    @Override
    public int insertUser(User user) {
        user.setPwd(Md5Util.encode(user.getPwd()));
        return userDao.insertUser(user);
    }

    @Override
    public int deleteById(String userid) {
        return 0;
    }

    @Override
    public User findUserById(String userid) {
        return null;
    }

    @Override
    public List<User> findUserList() {
        return null;
    }

    @Override
    public int updateUser(User user) {
        return 0;
    }

    @Override
    public boolean checkUserName(String username) {
        int rows = userDao.checkUserName(username);
        return rows > 0;
    }
}
